package com.s63.springboot3.controller;

import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class LoginController {
    @Autowired
    private Producer producer;

    @ResponseBody
    @RequestMapping("/login")
    public String login(String name, String password, String code, HttpSession session) {
        System.out.println(name);
        System.out.println("password = " + password);
        if (code.equals((String)session.getAttribute("code"))) {
            return "验证码正确";
        } else {
            return "验证码错误";
        }

    }



}
